package base;

import java.io.Serializable;
import java.util.Date;
import java.util.ArrayList;

public class Plan implements Cloneable,Serializable{
	private static final long serialVersionUID = 2655065116127427311L;
	private String title;
    private String content;
    private Date datetime;
    private int userbelongedto;
    private int id;
    private ArrayList <Integer> availableto;//�ɿ���˹����ƻ�����ϵ��ID
    private int level;//�����ƻ�����  0:����Ҫ  1:��ͨ  2:���� 3:���ض��˿ɼ�
    private int state;//����״̬  0:����� 1:��ִ�� 2:������
    private int visible;//�ɼ��� 0:�Լ��ɼ�(��ͨ�û�Ĭ��) 1:�ض���ϵ�˿ɼ� 2:�����˿ɼ�(������ϵ��Ĭ��)
    
    //=====�˹��캯��Ϊ�������ʹ��====//
    @SuppressWarnings("deprecation")
	public Plan(String title,String content,int currentuserid,ArrayList<Integer>availableto,int level,int state,int visible,String date){
    	this.title=title;
    	this.content=content;
    	this.userbelongedto=currentuserid;
    	this.availableto=availableto;
    	this.level=level;
    	this.state=state;
    	this.visible=visible;
    	this.datetime=new Date(date);
    }
    public Plan(int id,String title,String content,int currentuserid,ArrayList<Integer>availableto,int level,int state,int visible,Date date){
    	this.id=id;
    	this.title=title;
    	this.content=content;
    	this.userbelongedto=currentuserid;
    	this.availableto=availableto;
    	this.level=level;
    	this.state=state;
    	this.visible=visible;
    	this.datetime=date;
    }
    
    public Plan(String title,String content,int currentuserid,ArrayList<Integer>availableto,int level,int state,int visible,Date date){
    	this.title=title;
    	this.content=content;
    	this.userbelongedto=currentuserid;
    	this.availableto=availableto;
    	this.level=level;
    	this.state=state;
    	this.visible=visible;
    	this.datetime=date;
    }
    public Plan(String title,String content,int currentuserid){
    	this(title, content, currentuserid, new ArrayList<Integer>(), 0,0,0,new Date());
    }
    
    public String gettitle(){
    	return this.title;
    }
    public String getcontent(){
    	return this.content;
    }
    public Date getdate(){
    	return this.datetime;
    }
    public int getowner(){
    	return this.userbelongedto;
    }
    public ArrayList <Integer> getavailable(){
    	return this.availableto;
    }
    public int getlevel(){
    	return this.level;
    }
    public int getState(){
    	return this.state;
    }
    public int getVisible(){
    	return this.visible;
    }
    public int getid(){
    	return this.id;
    }
    
    public Plan clone(){
    	ArrayList <Integer> availableto=null;
    	if(this.availableto!=null){
    		availableto=new ArrayList <Integer>();
    		for(int i=0;i<this.availableto.size();i++){
        		availableto.add(this.availableto.get(i));
        	}
    	}
    	Plan p=new Plan(this.title,this.content,this.userbelongedto,availableto,this.level,this.state,this.visible,(Date)this.datetime.clone());
    	return p;
    }
}
